/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("Dic_大类名称选项",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using VOL.Entity.DomainModels;
using VOL.Order.IServices;
using VOL.Core.Utilities;
using Newtonsoft.Json;

namespace VOL.Order.Controllers
{
    public partial class Dic_大类名称选项Controller
    {
        private readonly IDic_大类名称选项Service _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public Dic_大类名称选项Controller(
            IDic_大类名称选项Service service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }
        [HttpPost]
        [Route("Get名称选项")]
        public ActionResult Get大类名称选项([FromBody] Dic_大类名称选项 dic)
        {
            VOL.Core.Services.Logger.Info("1根据大类 名称查大类名称选项,请求:" + JsonConvert.SerializeObject(dic));
            WebResponseContent webResponse = new WebResponseContent();
            var result = _service.Get大类名称选项(dic);
            VOL.Core.Services.Logger.Info("3根据大类 名称查大类名称选项,结果:" + JsonConvert.SerializeObject(result));
            if (result != null && result.Count > 0)
            {
                webResponse.Code = "0";
                webResponse.Data = result;
            }
            else
            {
                webResponse.Code = "1";
                webResponse.Message = $"未查到{dic.大类},{dic.名称}对应的数据";
            }
            VOL.Core.Services.Logger.Info("3根据自己班组获取班组任务,返回值:" + JsonConvert.SerializeObject(webResponse));
            return Json(webResponse);
        }
    }
}
